//
//  UIImage+CYGImageWithColor.m
//  CYGHuntForCity
//
//  Created by cygarm on 16/3/9.
//  Copyright © 2016年 cygarm. All rights reserved.
//

#import "UIImage+CYGImageWithColor.h"

@implementation UIImage (CYGImageWithColor)

+ (UIImage *)cyg_imageWithColor:(UIColor *)color {
	CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
	UIGraphicsBeginImageContext(rect.size);
	CGContextRef context = UIGraphicsGetCurrentContext();
	
	CGContextSetFillColorWithColor(context, [color CGColor]);
	CGContextFillRect(context, rect);
	
	UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
	UIGraphicsEndImageContext();
	
	return image;
}

@end
